package com.lw.extraceim.ui.activity.user;

import androidx.appcompat.app.AppCompatActivity;

import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;

import com.lw.extraceim.R;
import com.lw.extraceim.ui.activity.base.BaseActivity;

public class UserChangeActivity extends BaseActivity {
    private EditText mEditTextUserName,mEditTextUserPhone;
    private Button mButtonSave;
    private ImageButton mImageButtonBack;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

    }

    @Override
    public void initView() {
        setContentView(R.layout.activity_user_change);
        mEditTextUserName=findViewById(R.id.et_user_name);
        mEditTextUserPhone=findViewById(R.id.et_user_phone);
        mButtonSave=findViewById(R.id.btn_save);
        mImageButtonBack=findViewById(R.id.btn_back);
    }

    @Override
    public void initData() {

    }

    @Override
    public void refreshUI() {

    }

    @Override
    public void initEvent() {
        mButtonSave.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                showAlert();
            }
        });
        mImageButtonBack.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
    }
    /*展示对话框*/
    private void showAlert() {
        AlertDialog.Builder builder=new AlertDialog.Builder(this);
        builder.setTitle("提示").setMessage("确定修改吗？").setPositiveButton("确定", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                //做保存修改的操作
                String name = mEditTextUserName.getText().toString();
                String phone=mEditTextUserPhone.getText().toString();
            }
        }).setNegativeButton("取消", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                dialog.dismiss();
            }
        }).show();
    }

    @Override
    public void onBackPressed() {
        finish();
    }
}
